/**
 * Copyright 2010 Victor Egea Hernando
 *
 * RockScript is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * RockScript is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with RockScript.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef PJIT_X86_H_
#define PJIT_X86_H_

#include "./../../pjit.h"
#include "./../pjit_codegen.h"

namespace pjit{

// flags
enum __x86_flags{
	X86_32 = 1, X86_64 = 2
};
// print flags
enum __x86_pmode{
	PRINT_UINT = 1, PRINT_INT = 2, PRINT_REAL = 4, PRINT_HEX = 8
};
// mode
enum __x86_mod{
	MODRM_REG16      = 0, MODRM_REG16OFF8 = 1,
	MODRM_REG16OFF16 = 2, MODRM_REG32     = 3
};
// registers
enum __x86_reg{
	RAL   = 0, RCL   = 1, RDL   = 2, RBL   = 3,
	RAH   = 4, RCH   = 5, RDH   = 6, RBH   = 7,
	REAX  = 0, RECX  = 1, REDX  = 2, REBX  = 3,
	RESP  = 4, REBP  = 5, RESI  = 6, REDI  = 7,
	RXMM0 = 0, RXMM1 = 1, RXMM2 = 2, RXMM3 = 3,
	RXMM4 = 4, RXMM5 = 5, RXMM6 = 6, RXMM7 = 7
};
// combinations
enum __x86_rm{
	CBXSI   = 0, CBXDI   = 1, CBPSI   = 2, CBPDI   = 3,
	CSI     = 4, CDI     = 5, CBP     = 6, CBX     = 7,
	CEAX    = 0, CECX    = 1, CEDX    = 2, CEBX    = 3,
	CESP    = 4, CEBP    = 5, CESI    = 6, CEDI    = 7,
	CXMM0   = 0, CXMM1   = 1, CXMM2   = 2, CXMM3   = 3,
	CXMM4   = 4, CXMM5   = 5, CXMM6   = 6, CXMM7   = 7,
	CDISP16 = 6
};
// opcodes
enum __x86_opcodes{
	OP_RET_C3     = 0xC3, OP_LEAVE_C9   = 0xC9,
	OP_PUSH_68    = 0x68,
	OP_SPECIAL_FF = 0xFF, OP_SPECIAL_81 = 0x81,
	OP_MOV_B8     = 0xB8, OP_MOV_8B     = 0x8B

};

};

#endif // PJIT_X86_H_
